package com.xinchen.gufeiwulian.ui.fragment

import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.lifecycle.Observer
import com.maple.base.base.BaseFragment
import com.xinchen.gufeiwulian.R
import com.xinchen.gufeiwulian.vm.HomeViewModel

class MineFragment(val viewModel: HomeViewModel) : BaseFragment() {
    companion object {
        @JvmStatic
        fun getInstance(viewModel: HomeViewModel): MineFragment {
            return MineFragment(viewModel)
        }
    }
    override fun getLayoutId(): Int = R.layout.fragment_mine

    override fun initView(view: View, savedInstanceState: Bundle?) {
        super.initView(view, savedInstanceState)
        view.findViewById<TextView>(com.maple.res.R.id.tv_title_center)?.text = "我的"
    }
    override fun initData(savedInstanceState: Bundle?) {
        viewModel.defUI.showDialog.observe(this, Observer {
            showLoading()
        })

        viewModel.defUI.dismissDialog.observe(this, Observer {
            dismissLoading()
        })

        viewModel.defUI.toastEvent.observe(this, Observer {
            showToast(it)
        })
    }

}